from apps.common.account.models import Account


# def add_userDatas():
#     """ 将userInfo视图里的用户加入到系统的Account表(只添加不更新) """
#     users_username = Account.objects.all().values_list('username', flat=True).iterator()
#     users_qs = UserInfoDbView.objects.exclude(username__in=users_username).values().iterator()
#
#     bulk_create_data = []
#     for user_qs in users_qs:
#         user = Account(username=user_qs['username'], realname=user_qs['realname'],
#                        faculty_code=user_qs['faculty_code'] if user_qs['faculty_code'] else '',
#                        faculty_title=user_qs['faculty_title'] if user_qs['faculty_title'] else '',
#                        status=user_qs['status'] if user_qs['status'] else '',
#                        grade_name=user_qs['grade_name'] if user_qs['grade_name'] else '',
#                        type=user_qs['type'] if user_qs['type'] else '',
#                        class_code=user_qs['class_code'] if user_qs['class_code'] else '',
#                        class_title=user_qs['class_title'] if user_qs['class_title'] else '',
#                        )
#         bulk_create_data.append(user)
#
#     if bulk_create_data:
#         Account.objects.bulk_create(bulk_create_data, batch_size=5000, ignore_conflicts=True)
#
#     return True